package com.eagle.epay.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/rabbitmq")
public class RabbitMQSenderController {
	@Autowired
	private RabbitTemplate rabbitTemplate;

	@Autowired
	private Environment env;

	@GetMapping("/fanoutSender")
	public String sendFanout() {
		this.rabbitTemplate.convertAndSend(env.getProperty("epay.rabbitmq.fanout.exchange.name"),"","hello");
		return "send fanout ok";
	}
}
